﻿
using zijian666.WorkScheduler.Defines;

namespace zijian666.WorkScheduler.Abstractions;

/// <summary>
/// 工作数据缓冲区
/// </summary>
public interface IWorkDataBuffer
{
    /// <summary>
    /// 数据待执行的数量
    /// </summary>
    int PendingCount { get; }

    /// <summary>
    /// 获取并锁定工作数据
    /// </summary>
    Task<WorkData> GetAndLocking(string ticket, IWorkManager manager, CancellationToken cancellation);

    /// <summary>
    /// 刷新数据
    /// </summary>
    void RefreshAll(IEnumerable<WorkData> works);
}